package com.cskaoyan.mall.controller.admin;

import com.cskaoyan.mall.bean.vo.ResultVO;


import com.cskaoyan.mall.bean.vo.UserManagerVO;
import com.cskaoyan.mall.service.UserService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;



/**
 * @name zhangguannan
 * @Date 2021-01-09 17:08
 */
@RestController
@RequestMapping("admin")
public class UserManageController {

    @Autowired
    UserService userService;

    @RequestMapping("/user/list")
    public ResultVO userList(Integer page,Integer limit,String username,String mobile,
                             String sort,String order){

        UserManagerVO userManagerVO = userService.queryUserList(page,limit,username,mobile,sort,order);

        return ResultVO.ok(userManagerVO);
    }

    @RequestMapping("address/list")
    public ResultVO addressList(Integer page,Integer limit,String name,Integer userId,String sort,String order){
        UserManagerVO userManagerVO = userService.queryAdressList(page,limit,name,userId,sort,order);

        return ResultVO.ok(userManagerVO);
    }

    @RequestMapping("collect/list")
    public ResultVO collectList(Integer page, Integer limit, Integer userId, Integer valueId, String sort, String order) {
        UserManagerVO collectVO = userService.queryCollectList(page, limit, userId, valueId, sort, order);
        return ResultVO.ok(collectVO);
    }

    @RequestMapping("footprint/list")
    public ResultVO footPrint(Integer page, Integer limit, Integer userId, Integer goodsId, String sort, String order){
        UserManagerVO footprintVO = userService.queryFootPrintList(page, limit, userId, goodsId, sort, order);
        return ResultVO.ok(footprintVO);
    }

    @RequestMapping("history/list")
    public ResultVO historyList(Integer page, Integer limit, Integer userId, String keyword, String sort, String order) {
        UserManagerVO historyListVO = userService.queryHistoryList(page,limit,userId,keyword,sort,order);
        return ResultVO.ok(historyListVO);

    }

    @RequestMapping("feedback/list")
    public ResultVO feedbackList(Integer page,Integer limit,String username,String sort,String order,Integer id){

        //TODO   未完待续.... 图片地址封装的类型转换问题
        UserManagerVO feedbackListVO = userService.queryFeedbackList(page,limit,username,sort,order,id);

        return ResultVO.ok(feedbackListVO);
    }

}
